package com.sojoys.artifact.manager;

import com.sojoys.artifact.factory.bytebuff.ArrayByteBuffFactory;
import com.sojoys.artifact.factory.bytebuff.IByteBuff;
import com.sojoys.artifact.factory.bytebuff.IByteBuffFactory;

public class ByteBuffManager {
	private ByteBuffManager() {
	}

	private static ByteBuffManager ME = new ByteBuffManager();

	public static ByteBuffManager me() {
		return ME;
	}
	
	private IByteBuffFactory factory = new ArrayByteBuffFactory();

	public void setFactory(IByteBuffFactory factory) {
		this.factory = factory;
	}

	public IByteBuff allocate() {
		return this.factory.allocate();
	}
	
	public IByteBuff wrap(byte[] data) {
		return this.factory.wrap(data);
	}
}
